<%@ include file="/common/header.jsp" %>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<style>

.btn .btn-default .default {
    color:#919191;
    background: center no-repeat;
    height: 26px;
}

.btn .btn-default .default:hover {
   color: #0078C7;
   background: center no-repeat #dff1ff;
}

thead th {
    color : #396D98;
    font-size: 14px;
    font-weight: 500;
}

tr:hover {
    background-color: #E2F2FF;
}

tr a:hover{color: blue;}

.otherText {
    width: 200px;
    height:25px;
    border: 1px solid #CCCCCC !important;
}


.grid_tbody_noscoll{
    overflow: auto;
} 
.gird-td-ellipsis{
    overflow: hidden;!important;
    text-overflow: ellipsis;!important;
    white-space: nowrap;!important;
}

.table>tbody>tr>td, .table>tbody>tr>th, .table>tfoot>tr>td, .table>tfoot>tr>th, .table>thead>tr>td, .table>thead>tr>th{
    padding:0;
    overflow: hidden;
}
.table>tbody>tr>td{
    padding:0 5px 0px 8px;
    border-bottom: 1px solid #ddd;
}
.pt-edit-table>thead tr td:last-child {
    border-right: 1px solid #9ECAF1;
}
.pt-edit-table,.pt-edit-table>thead tr th{
    border:0;
    table-layout:fixed;
}
.table>thead>tr>th {
    height: 40px;
}
.relativeClass{
    position:relative;
    z-index: 4100;
}
.topClass{
    top: 8px;
}
.hsrhTable {
 width: 96%;
}
.hsrhTable input{
    width: 100%;
}
.dynamic-select-div{
    min-height: 30px;
    max-height: 30px;
}
.main-box .input-group-addon {
    margin-top: -9px;
}
.dynamic-span {
    margin-top: 5px;
}
.glyphicon-pt-organization{
    margin-right: -25px;
}


</style>
 <body>
	<div class="container-full"
		ng-controller="DynaQueryController_1591610606163024162304">
		<div class="edit-header">
			<div class="col-xs-4 edit-title">
				<span ng-if="true"><i class="icon"></i> <i>动态列示例</i></span>
			</div>
		</div>
		<div id="page_body_content_1591610606163024162304"
			class="edit-body main-box" style="padding: 0; margin-right: 0">
			<div id="body_button_1591610606163024162304"
				style="margin-bottom: -15px;">
				<div class="edit-btn-box"
					ng-class="{'relativeClass': isDefaultSearch}"
					style="padding-top: 15px;">
					<div ng-class="{'topClass': !isDefaultSearch}"
						style="position: absolute; right: 0; z-index: 4;">
						<button key="15916105916963" type="button"
							ng-click='exportClick()'
							ng-if="grid_1591610606163024162304.gridApi.controll.displayControll('15916105916963') && !grid_1591610606163024162304.readOnly"
							ng-hide='' ng-disabled='' class="btn btn-default btn-sm default">导出</button>
					</div>
				</div>
			</div>
			<input id='fileSelect' type='file' nv-file-select uploader='uploader'
				style='display: none;' multiple />
			<div id="body_searchbar_1591610606163024162304">
				<pt-adv-query
					query-option="grid_1591610606163024162304.queryOptions"></pt-adv-query>
			</div>
			<div class="col-md-12" style="padding: 0;" name="validateForm">
				<form id="validateForm" class="pt-border-line form-horizontal"
					role="form" novalidate name="validateForm" edit-table-son>
					<div id="grid_tbody_1591610606163024162304"
						class="grid_tbody_noscoll" style='overflow: auto;'>
						<table class="table pt-edit-table"
							id="grid_tbody_table_1591610606163024162304"
							style="table-layout: fixed; margin-bottom: -1px;">
							<colgroup>
								<col class="col-ROW_ID" style="width: 50px" />
								<col class="col-JCPC" style="width: 120px" />
								<col class="col-GZZ" style="width: 200px" />
								<col class="col-CQTS" style="width: 120px" />
								<col class="col-QJTS" style="width: 120px" />
								<col class="col-SFTJ" style="width: 120px" />
                                <col ng-repeat="item in kqrqList" class="col-SFYX" style="width: 120px" />
							</colgroup>
							<thead>
								<tr>
									<th class="center thead-ROW_ID"
										style="vertical-align: middle; cursor: pointer;"><div
											class='thead-div' ng-class="{'disabled':isView}">序号</div></th>
									<th class="center thead-XM"
										style="vertical-align: middle; cursor: pointer;"><div
											class='thead-div' ng-class="{'disabled':isView}">姓名</div></th>
									<th class="center thead-GZZ"
										style="vertical-align: middle; cursor: pointer;"><div
											class='thead-div' ng-class="{'disabled':isView}">工作组</div></th>
									<th class="center thead-CQTS"
										style="vertical-align: middle; cursor: pointer;"><div
											class='thead-div' ng-class="{'disabled':isView}">出勤天数</div></th>
									<th class="center thead-QJTS"
										style="vertical-align: middle; cursor: pointer;"><div
											class='thead-div' ng-class="{'disabled':isView}">请假天数</div></th>
									<th class="center thead-QQTS"
										style="vertical-align: middle; cursor: pointer;"><div
											class='thead-div' ng-class="{'disabled':isView}">缺勤天数</div></th>
									<th ng-repeat="item in kqrqList" class="center thead-SFTJ"
										style="vertical-align: middle; cursor: pointer;"><div
											class='thead-div' ng-class="{'disabled':isView}">{{item.date_cn}}<br>{{item.week_cn}}</div></th>
							<tbody>
								<tr style='cursor: pointer;'
									ng-repeat="rowdata in grid_1591610606163024162304.gridOptions.data"
									on-finish-render-filters
									ng-click="grid_1591610606163024162304.gridEvent._rowSelected(rowdata,$index,$event)"
									class="editTableRows_{{$index}}"
									ng-dblclick="grid_1591610606163024162304.gridEvent._rowSelected(rowdata,$index,$event)">
									<td title={{rowdata.ROW_ID}} align="left"
										class=" tdbody-ROW_ID "
										style="vertical-align: middle; word-break: break-all;">{{rowdata.ROW_ID}}</td>
									<td title={{rowdata.XM}} align="left"
										class=" tdbody-XM "
										style="vertical-align: middle; word-break: break-all;">{{rowdata.XM}}</td>
									<td title={{rowdata.GZZ}} align="left" class=" tdbody-GZZ "
										style="vertical-align: middle; word-break: break-all;"><a
										onclick="javascript: void(0);" style="cursor: pointer;"
										ng-Click=viewClick(rowdata)>{{rowdata.GZZ}}</a></td>
									<td title={{rowdata.CQTS}} align="center" class=" tdbody-CQTS "
										style="vertical-align: middle; word-break: break-all;">{{rowdata.QJTS}}</td>
                                    <td title={{rowdata.QJTS}} align="center"
                                        class=" tdbody-QJTS "
                                        style="vertical-align: middle; word-break: break-all;">{{rowdata.QJTS}}</td>
                                    <td title={{rowdata.QJTS}} align="center"
                                        class=" tdbody-QQTS "
                                        style="vertical-align: middle; word-break: break-all;">{{rowdata.QQTS}}</td>
									<td ng-repeat="kqrq in kqrqList" title={{rowdata.SFTJ}} align="center" class=" tdbody-SFTJ "
										style="vertical-align: middle; word-break: break-all;"><a
                                        onclick="javascript: void(0);" style="cursor: pointer;"
                                        ng-Click=viewClick(rowdata)>{{rowdata[kqrq.date]}}</a></td>
								</tr>
								<tr ng-if="grid_1591610606163024162304.page.bigTotalItems == 0">
									<td align="center" style="vertical-align: middle; color: red;"
										colspan="9">没有查询到数据</td>
								</tr>
							</tbody>
						</table>
					</div>
				</form>
			</div>
			<div id="grid_page_1591610606163024162304"
				ng-if="grid_1591610606163024162304.gridOptions.isPageable">
				<div class="col-sm-10 col-md-10" style="padding: 0;">
					<uib-pagination type="iconText"
						ng-change="grid_1591610606163024162304.gridEvent._pageChanged()"
						total-items="grid_1591610606163024162304.page.bigTotalItems"
						ng-model="grid_1591610606163024162304.page.currentPage"
						max-size="10"
						items-per-page="grid_1591610606163024162304.page.itemsPerPage"
						class="pagination-sm" style="margin:10px;" boundary-links="true"
						force-ellipses="true"></uib-pagination>
					<span class="paginationBtn"
						style="display: block; height: 28px; vertical-align: middle; float: left; overflow: hidden; line-height: 28px; padding: 0"><button
							style="margin: 0" type="button"
							class="btn btn-default btn-sm btn-white"
							ng-click="grid_1591610606163024162304.gridEvent._refresh()">
							<span class="glyphicon glyphicon-refresh"></span>
						</button></span><span
						style="display: block; height: 100%; vertical-align: middle; float: left; line-height: 28px">每页<select
						style="margin: 0;"
						ng-change="grid_1591610606163024162304.gridEvent._changeItemsPerPage(grid_1591610606163024162304.page.selected)"
						ng-model="grid_1591610606163024162304.page.selected"
						ng-options="x.value as x.name for x in grid_1591610606163024162304.page.ITEMSPERPAGE"></select>条
					</span>
				</div>
				<div class="col-sm-2 col-md-2 pagecount"
					style="text-align: center; padding: 0; height: 28px; line-height: 28px; color: black;">
					共 {{ grid_1591610606163024162304.page.bigTotalItems }} 条</div>
			</div>
		</div>
	</div>

	<script type="text/javascript" src="/fwszpt/resources/platform/common/component/queryservice/analysis/edit-grid.js?v=2020-9-5"></script>
<script>
var listConfig = {"targeDatatType":"form","targetData":{"formId":"2020052315094933b2bfe3ffd84ff9b1d634b4b846f822","formName":"项目管理","dataSource":"jdbc/default","childTables":[],"select":"HS.XH,\n\tHS.XM,\n\tHS.GZZ,\n\tHS.SSSF,\n\tHS.SSDS,\n\tHS.SSQX,\n\tCONCAT( '山东省', D.XZQH, '', IFNULL( F.XZQH, '' ) ) AS 'CQTS',\n\tHS.SSXZ,\n\tHS.SSCZ,\n\tHS.XMDZ\n        ,HS.SFTJ\n\t,HS.SFYX\n\t,HS.QJTS\n\t,HS.JCPC\nFROM\n\tT_FWSZPT_RWGL_XMHS2 HS\n\tLEFT JOIN t_platform_xzqhdm D ON D.XZJB = '2' \n\tAND HS.SSDS = D.XZQHDM\n\tLEFT JOIN t_platform_xzqhdm F ON F.XZJB = '3' \n\tAND HS.SSQX = F.XZQHDM","where":"","orderBy":""},"targetColumns":[{"zdm":"","zd":"XH","zdlx":"string","isChecked":false,"isEntity":true,"isSearchChecked":false,"$$hashKey":"object:1415"},{"zdm":"","zd":"XM","zdlx":"string","isChecked":true,"isEntity":true,"isSearchChecked":true,"$$hashKey":"object:1416"},{"zdm":"","zd":"GZZ","zdlx":"string","isChecked":true,"isEntity":true,"isSearchChecked":true,"$$hashKey":"object:1417"},{"zdm":"","zd":"SSSF","zdlx":"string","isChecked":false,"isEntity":true,"isSearchChecked":false,"$$hashKey":"object:1418"},{"zdm":"","zd":"SSDS","zdlx":"string","isChecked":false,"isEntity":true,"isSearchChecked":false,"$$hashKey":"object:1419"},{"zdm":"","zd":"SSQX","zdlx":"string","isChecked":false,"isEntity":true,"isSearchChecked":true,"$$hashKey":"object:1420"},{"zdm":"","zd":"CQTS","zdlx":"string","isChecked":true,"isEntity":true,"isSearchChecked":false,"$$hashKey":"object:1421"},{"zdm":"","zd":"SSXZ","zdlx":"string","isChecked":false,"isEntity":true,"isSearchChecked":false,"$$hashKey":"object:1422"},{"zdm":"","zd":"SSCZ","zdlx":"string","isChecked":false,"isEntity":true,"isSearchChecked":false,"$$hashKey":"object:1423"},{"zdm":"","zd":"XMDZ","zdlx":"string","isChecked":false,"isEntity":true,"isSearchChecked":false,"$$hashKey":"object:1424"},{"zdm":"","zd":"SFTJ","zdlx":"string","isChecked":true,"isEntity":true,"isSearchChecked":false,"$$hashKey":"object:1425"},{"zdm":"","zd":"SFYX","zdlx":"string","isChecked":true,"isEntity":true,"isSearchChecked":false,"$$hashKey":"object:1426"},{"zdm":"","zd":"QJTS","zdlx":"string","isChecked":true,"isEntity":true,"isSearchChecked":false,"$$hashKey":"object:1427"},{"zdm":"","zd":"JCPC","zdlx":"string","isChecked":true,"isEntity":true,"isSearchChecked":true,"$$hashKey":"object:1428"}],"isShowSeq":true,"isPageable":true,"gridDropCompColumnIsShow":false,"isShowTitle":true,"titleName":"项目核实运维","pageSize":10,"buttons":[{"key":"15916105916963","displayName":"导出","type":"normal","function":"exportClick()","$$hashKey":"uiGrid-000R"}],"tableWidth":"","javascriptFilePath":"","customQueryService":"","columns":[{"name":"ROW_ID","type":"#XH","displayName":"序号","index":1,"width":"50px","rowspan":1,"colspan":1,"isShow":true,"events":{},"display":{}},{"name":"JCPC","type":"string","displayName":"检查批次","index":2,"width":"120px","isEntity":true,"groupBy":"","rowspan":1,"colspan":1,"isShow":true,"events":{},"display":{"type":"","content":"","align":"center"}},{"name":"XM","type":"string","displayName":"项目下发编号","index":3,"width":"120px","isEntity":true,"groupBy":"","rowspan":1,"colspan":1,"isShow":true,"events":{},"display":{"content":"","align":"left"}},{"name":"GZZ","type":"string","displayName":"项目名称","index":4,"width":"*","isEntity":true,"groupBy":"","rowspan":1,"colspan":1,"isShow":true,"events":{"ng-Click":"viewClick(rowdata)"},"display":{"type":"text","content":"","align":"left"}},{"name":"CQTS","type":"string","displayName":"行政区划","index":5,"width":"200px","isEntity":true,"groupBy":"","rowspan":1,"colspan":1,"isShow":true,"events":{},"display":{"type":"XZQY","content":{"SHENG":"SSSF","SHI":"SSDS","QU":"SSQX"},"align":"center"}},{"name":"QJTS","type":"string","displayName":"项目建设单位","index":6,"width":"240px","isEntity":true,"groupBy":"","rowspan":1,"colspan":1,"isShow":true,"events":{},"display":{"content":"","align":"left"}},{"name":"SFTJ","type":"string","displayName":"是否提交","index":7,"width":"80px","isEntity":true,"groupBy":"","rowspan":1,"colspan":1,"isShow":true,"events":{},"display":{"type":"COMMON_CODE","content":{"dmjbh":"COMMON_SF"},"align":"center"}},{"name":"SFYX","type":"string","displayName":"是否有效","index":8,"width":"80px","isEntity":true,"groupBy":"","rowspan":1,"colspan":1,"isShow":true,"events":{},"display":{"type":"COMMON_CODE","content":{"dmjbh":"COMMON_SF"},"align":"center"}},{"name":"操作","type":"#CZL","displayName":"操作","index":9,"width":"200px","groupBy":"","rowspan":1,"colspan":1,"isShow":true,"events":{},"display":{"type":"OPERATE_BTN","content":[{"key":"15916105916964","displayName":"撤回","function":"recallClick(rowdata)","index":"","className":"","style":"","nghide":"","btnId":"","buttonType":null},{"key":"1595245209130","displayName":"设置无效","function":"setXmwxClick(rowdata)","index":"","className":"","style":"","nghide":"","btnId":"","buttonType":"1"}],"align":"center"}}]};
//Javascript Document
var appTest = Common.initApp(['ngAnimate', 'ui.bootstrap','angular.filter','angularFileUpload','ng-slide-down']);
// var appTest;
var app = Common.getAppName(appTest,['ngAnimate', 'ui.bootstrap','angular.filter','angularFileUpload','ng-slide-down']);
/*File.direcFile(app);*/
Common.initDirective(app);
//调用方法初始化组件
File.init(app);

//行业类型、行政区域四级联动常量
app.constant('powerLinkageConstant', {
    HYLX : {
        dataUrl: Common.webRoot() + '/power/kit/industrytype/industrycontroller/queryhylxs'
    },
    XZQH : {
        dataUrl: Common.webRoot() + '/platform/system/administrativeregioncontroller/queryAdministrativeRegionByCondition',
        firstDataParams: {XZJB: '1'},
        secondDataParams: {XZJB: '2'},
        textField: 'JC',
        valueField: 'XZQHDM'
    }
}); 

app.controller('DynaQueryController_1591610606163024162304', ['$rootScope','$scope', '$http','FileUploader', '$log', '$interval', 'uiGridConstants','$templateCache','$timeout','$compile','$sce',
      function ($rootScope,$scope, $http, FileUploader, $log, $interval, uiGridConstants,$templateCache,$timeout,$compile,$sce) {
     
    //url参数处理
    $scope.GetRequest = function(){
        var url = location.search; //获取url中"?"符后的字串 
        var theRequest = new Object();
        if (url.indexOf("?") != -1) { 
            var str = url.substr(1); 
            var strs = str.split("&"); 
            for(var i = 0; i < strs.length; i ++) { 
            theRequest[strs[i].split("=")[0]]=unescape(strs[i].split("=")[1]); 
        } 
        return theRequest; 
        } 
     }
     $scope.UrlParams = $scope.GetRequest();
    //导入
     var uploader = $scope.uploader = Common.excelImport.getUploader(FileUploader);    
    // 高级查询配置

    $scope.queryParamData = {
    	    "quickMatch": [
    	                   "XM",
    	                   "GZZ"
    	               ],
    	               "queryField": [
    	                   {
    	                       "name": "XM",
    	                       "dataType": "string",
    	                       "title": "姓名",
    	                       "type": "text",
    	                       "operate": "=",
    	                       "quickMatch": true,
    	                       "isShow": false,
    	                       "isReadOnly": "true",
    	                       "isShowButton": "true"
    	                   },
    	                   {
    	                       "name": "GZZ",
    	                       "dataType": "string",
    	                       "title": "工作组",
    	                       "type": "text",
    	                       "operate": "LIKE",
    	                       "quickMatch": true,
    	                       "isShow": false,
    	                       "isReadOnly": "true",
    	                       "isShowButton": "true"
    	                   },
    	                   {
    	                       "name": "KQRQ",
    	                       "dataType": "date",
    	                       "title": "考勤日期",
    	                       "type": "date",
    	                       "operate": "RANGE",
    	                       "isShow": true,
    	                       "dateFormat": "yyyy-MM-dd",
    	                       "dateLabel2":["month","quarter","year"]
    	                   }
    	               ],
    	               "isAbsolutePosition": false,
    	               "isDefaultSearch": true
    	           };
    
    var gridConfig = {};
    
    //默认非只读（该标识用于控制按钮等是否显示）
    gridConfig.readOnly = false;
    
    $scope.selectAll = {
            checked : false
    };
    
    $scope.grid_1591610606163024162304 = gridConfig;
    
    gridConfig.xh = "1591610606163024162304";
    gridConfig.title = "项目核实运维";
    gridConfig.exportFilds = "JCPC,XM,GZZ,CQTS,QJTS,SFTJ,SFYX";
    
    // 定义回调函数
    gridConfig.callback = {
        // 数据加载完成后回调函数（由业务扩展）
        onLoadDataCallBack : function (response) {},
        // 表格渲染完成回调函数 （由业务扩展）
        onGridFinishCallback : function (grid) {},
        //行点击回调
        rowClickCallback:function (rowdata) {},
        pageChangedCallback:function(columns){}
    }
    
    gridConfig.gridOptions = {
        // 是否编辑模式（暂无实现）
        isEdit : false,
        // 表格类型
        type : "3",
        // 单选/多选
        multiSelect : {"XH":"1591610606163024162304","isView":"","isImmediatelyQuery":true,"multi":true}.multi,
        //进入页面是否立即查询
        isImmediatelyQuery : {"XH":"1591610606163024162304","isView":"","isImmediatelyQuery":true,"multi":true}.isImmediatelyQuery,
        // 需要控制的控件key，多个用,分隔，要对全部的受控组件产生作用，则用*
        hideKeys : {"XH":"1591610606163024162304","isView":"","isImmediatelyQuery":true,"multi":true}.hideKeys,
        // 是否分页
        isPageable : true,
        selected : {
            idField : "XH",
            nameField : "nameField",
            items : []
        },
        otherItem : ""
    }
    gridConfig.page = {
        ITEMSPERPAGE : [
          {name:'10',value:10},
          {name:'20',value:20},
          {name:'50',value:50},
          {name:'100',value:100},
          {name:'200',value:200},
          {name:'500',value:500}
        ]
       }
    
    if (TOP_WINDOW.window.dynaQuerySelected) { // 获取已选择的内容,用户回显
        gridConfig.gridOptions.selected = JSON.parse(TOP_WINDOW.window.dynaQuerySelected);
    }
    
    /**
    * 查询基本配置
    */
    var seachInputTips = "没有定义需要快速查询的字段";
    if ($scope.queryParamData && $scope.queryParamData.quickMatch) {
        seachInputTips = "请输入 ";
        for (var seq = 0; seq < $scope.queryParamData.quickMatch.length; seq++) {
            for (var i in $scope.queryParamData.queryField) {
                var name =$scope.queryParamData.queryField[i].name;
                if($scope.queryParamData.queryField[i].alias){
                    name = $scope.queryParamData.queryField[i].alias+"."+name
                }
                if (name == $scope.queryParamData.quickMatch[seq] && $scope.queryParamData.queryField[i].quickMatch) {
                    seachInputTips += $scope.queryParamData.queryField[i].title + "，"
                }
            }
        }
        seachInputTips = seachInputTips.substring(0, seachInputTips.lastIndexOf('，'));
        seachInputTips += " 进行查询。";
    }
    
    //高级查询更多按钮处理
    $scope.queryParamData.hideMoreBtn = true;//默认隐藏
    if($scope.queryParamData.queryField){
        for(var i = 0;i<$scope.queryParamData.queryField.length;i++){
            var config = $scope.queryParamData.queryField[i];
            if(!config.quickMatch&&!config.isShow){//存在非快速匹配且隐藏的字段
                $scope.queryParamData.hideMoreBtn = false;//显示更多按钮
                break;
            }
            if(config.dataType!='string'&&!config.isShow){//存在非字符串且隐藏的字段
                $scope.queryParamData.hideMoreBtn = false;//显示更多按钮
                break;
            }
        }
    }
    
    //高级查询配置信息
    gridConfig.queryOptions = {
        showAdvQuery: false,
        isDefaultSearch:true,
        hideMoreBtn: $scope.queryParamData.hideMoreBtn,
        seachInputTips : seachInputTips,
        paramData: $scope.queryParamData.queryField,
        initQC :TOP_WINDOW.window.qc ? eval('('+TOP_WINDOW.window.qc+')') : [], // 初始化查询条件
        position : $scope.queryParamData.isAbsolutePosition,
        isDefaultSearch  : $scope.queryParamData.isDefaultSearch 
    }
    
    gridConfig.queryOptions.events = {
            
          //点击子参数事件
        clickSubItem: function(param) {
            
        },
        //高级查询按钮点击
        showBtnClick: function() {
            // 重新调整列表高度
            $timeout(function(){
                gridConfig.gridEvent._GridAutoHeight();
            },0);
        },
        //搜索按钮点击
        searchBtnClick: function(param) {
            gridConfig.gridEvent._search(param);
        },
        keyup:function(param){
         gridConfig.gridEvent._search(param);
        },
        paramInitFinshed : function (param) {
                    
        },
        clearBtnClick : function (){
            //清除复选框样式
            $("pt-adv-query").find('.magic-checkbox').attr("checked", false);
            $scope.selectAll.checked = false;
            $scope.clearClick();
        }
    }
    
    // 表格数据请求配置
    gridConfig.dataConfig = {
        url: Common.webRoot() + '/resources/business/demo/list-dynamic-columns-demo/serverDataDemo.jsp',
        // 请求参数
        data : {
            xh : '1591610606163024162304',
            urlParams : {"XH":"1591610606163024162304","isView":"","isImmediatelyQuery":true,"multi":true},
            pageSize : gridConfig.gridOptions.isPageable ? 10 : 10000, // 不分页，最多只显示10000条数据,
            pageNum : 1,
            executeQuery : {
                conditions : gridConfig.queryOptions.initQC
            },
            extendParam : {}
        },
        // 请求执行成功后回调函数
        appendSuccess : function (result) {
        	$scope.kqrqList=result.data.kzzd.kqrqList;
            gridConfig.gridEvent._onLoadDataCallBack(result);
            gridConfig.gridEvent._GridAutoHeight();
        }
    }
    //获取动态表单只读配置
    if(parent){
        try{
            var appElement = parent.document.querySelector("[ng-controller='dynamicController as ctrl']");
            if(appElement){
                var pscope = parent.angular.element(appElement).scope();
                if(pscope && pscope.isView){
                    $scope.isView = pscope.isView;
                }
            }
        }catch(e){
            console.log("获取动态表单scope异常");
            console.log(e);
        }
        
    }
    
    /*
     * 自定义方法
    */
            /*内置对象：
        $scope：angularJS内置对象
        gridConfig：表单的对象，可以设置回调函数、获取列表数据，获取已选中的数据，设置查询条件等。具体见：http://192.168.3.116:8016/read/platform/10-15
                实例：
                初始化查询条件：
                获取列表的所以数据：
                获取列表上已选择中的数据：
        */
        // 定义回调函数
        gridConfig.callback = {
               onLoadDataCallBack : function (response) {
                    // 数据加载完成后回调函数（按实际需实现具体的动作）
                },
               onGridFinishCallback : function (grid) {
                    // 表格渲染完成回调函数（按实际需实现具体的动作
                }
        };
    var formId = ""
    if(listConfig.targetData && listConfig.targetData.formId){
        formId = listConfig.targetData.formId;
    }
    //新增
    $scope.addClick = function(){
        Common.dialog({
                type: "open",
                title: "新增",
                width: "90%",
                height: "90%",
                url: Common.webRoot() + "/dynamicform/viewresolvercontroller/render/"+formId,
                end: function(){
                    gridConfig.gridEvent._refresh();
                }
        })
    };
    //删除
    $scope.delClick = function(){
        var row = gridConfig.gridApi.selection.getCheckedRow().items;
        if(row.length == 0){
            Common.dialog({
            type:"alert",
            content:"请选中要删除的记录！"
            });
            return false;
        }
        Common.dialog({
            type:"confirm",
            content:"确认删除该记录？",
            callback:function(index){
            var ids="";
            for(var i=0;i<row.length;i++){
                ids += row[i].value + "@" + formId + ",";
            }
            Common.send($scope, $http ,{
                method: "POST",
                url: Common.webRoot()+"/dynamicform/viewresolvercontroller/deletedata",
                data:JSON.stringify({
                "ids":ids.substring(0,ids.length - 1)
                }),
                showTips : true,
                success: function(data){
                gridConfig.gridEvent._refresh();
                }
            });
            }
        });
        }
      //导出
      $scope.exportClick = function(){
        $scope.exportExcel();
      }
    //删除行
    $scope.delRowClick = function(rowdata){
        Common.dialog({
            type:"confirm",
            content:"确认删除该记录？",
            callback:function(index){
            Common.send($scope, $http ,{
                method: "POST",
                url: Common.webRoot()+"/dynamicform/viewresolvercontroller/deletedata",
                data:JSON.stringify({
                "ids": encodeURIComponent(rowdata.XH) + "@" + formId
                }),
                showTips : true,
                success: function(data){
                gridConfig.gridEvent._refresh();
                }
            });
            }
        });
        }
        //撤回
        $scope.recallClick = function(rowdata){
            Common.send($scope, $http ,{
            method: "POST",
                    url: Common.webRoot() + "/fwszpt/rwgl/xmhs/recall/"+ encodeURIComponent(rowdata.XH) + " ",
                    data : {"xmhsXh":rowdata.XH},
                    showTips : true,
                    success: function(data){
                    gridConfig.gridEvent._refresh();
                    }           
        })
            }
        //撤回
        $scope.setXmwxClick = function(rowdata){
            Common.dialog({
                type:'confirm',
                content:'确定要设置项目“（'+rowdata.XM+'）'+rowdata.GZZ+'”无效吗？',
                callback:function(){
                    $scope._setXmwx(rowdata.XH);
                }
            })
            
        }
        
        //撤回
        $scope._setXmwx = function(xh){
            if(!xh){
                return;
            }
            Common.send($scope, $http ,{
            method: "POST",
                    url: Common.webRoot() + "/fwszpt/rwgl/xmhs/drop/"+ xh + " ",
                    data : {"xmhsXh":xh},
                    showTips : true,
                    success: function(data){
                    gridConfig.gridEvent._refresh();
                    }           
        })
            }
        
       //编辑
       $scope.editClick = function(rowdata){
        Common.dialog({
            type: "open",
            title: "编辑",
            width: "90%",
            height: "90%",
            url: Common.webRoot() + "/dynamicform/viewresolvercontroller/render/"+ formId +"?recordId=" + encodeURIComponent(rowdata.XH),
            end: function(){
                gridConfig.gridEvent._refresh();
            }               
        })
       }
       //预览
       $scope.viewClick = function(rowdata){
        Common.dialog({
            type: "open",
            title: "预览",
            width: "90%",
            height: "90%",
            url: Common.webRoot() + "/dynamicform/viewresolvercontroller/render/"+ formId +"?recordId=" + encodeURIComponent(rowdata.XH) + "&isView=true",
            end: function(){
            }               
        })
       };

       //预览
       $scope.viewClick = function(rowdata){
        Common.dialog({
            type: "open",
            title: "预览",
            width: "90%",
            height: "90%",
            url: Common.webRoot() + "/fwszpt/rwgl/xmhs/xmhs/ywView/"+ encodeURIComponent(rowdata.XH) + " ",
            end: function(){
            }               
        })
       };
        //数据列表加载前置事件
        $scope.beforeGridInit = function(gridConfig, gridInitFunction){
            var extendParam = {};
            gridConfig.dataConfig.data.extendParam = extendParam;
            gridInitFunction();
        }
    //无查询条件情况下默认非高级查询
    if(gridConfig.queryOptions.paramData.length<=0){
        gridConfig.queryOptions.isDefaultSearch = false;
    }
    $scope.isDefaultSearch =  gridConfig.queryOptions.isDefaultSearch;
    for (var i in gridConfig.queryOptions.paramData) {
        if (gridConfig.queryOptions.paramData[i].type == "date") {
            gridConfig.queryOptions.paramData[i].dateParams = function(){
                var param = gridConfig.queryOptions.paramData[i].dateLabel;
                var config = [];
                for(var index in param){
                    if(param[index] == 'date'){
                        config.push({type:"date",dateIntvs:[{text:"今天",intv:0},{text:"昨天",intv:-1}]});
                    }else if(param[index] == 'week'){
                        config.push({type:"week",dateIntvs:[{text:"近一周",intv:0},{text:"上周",intv:-1}]});
                    }else if(param[index] == 'month'){
                        config.push({type:"month",dateIntvs:[{text:"本月",intv:0},{text:"上月",intv:-1}]});
                    }else if(param[index] == 'quarter'){
                        config.push({type:"quarter",dateIntvs:[{text:"本季度",intv:0},{text:"上季度",intv:-1}]});
                    }else if(param[index] == 'year'){
                        config.push({type:"year",dateIntvs:[{text:"去年",intv:-1},{text:"今年",intv:0}]});
                    }
                }
                return config;
            }()
        }
        //自定义json转换
        if(gridConfig.queryOptions.paramData[i].type == "codeset"){
            if(gridConfig.queryOptions.paramData[i].dataSourceType == "json"){
                var data = $scope[gridConfig.queryOptions.paramData[i].jsonData];
                var datas = [];
                if(data&&data.length>0){
                     for(var j = 0;j < data.length;j++){
                         var obj = data[j];
                         obj['label'] = data[j].text;
                         obj['id'] = data[j].value;
                         datas.push(obj);
                     }
                     gridConfig.queryOptions.paramData[i].data = datas;
                     gridConfig.queryOptions.paramData[i].datas = datas;
                }
                
            }
        }
    }
    
    //grid初始化前事件调用
    if($scope.beforeGridInit){
        $scope.beforeGridInit(gridConfig, function (){
            var powerGrid = new PowerGrid();
            powerGrid.init($scope, $http, gridConfig);
        });
    }else{
        var powerGrid = new PowerGrid();
        powerGrid.init($scope, $http, gridConfig);
    }
    
    //确定事件
    $scope.confirmClick = function(){
        gridConfig.gridSelectedEvent.confirm();
    }
    //关闭事件
    $scope.closeClick = function(){
        gridConfig.gridSelectedEvent.close();
    }
    //清除选中
    $scope.clearClick = function(){
        $scope.selectAll.checked = false;
        gridConfig.gridApi.selection.clearSelectedRows();
    }
    
    //如果自定义脚本中没有指定导出方法，则使用默认导出方法
    if(typeof $scope.exportExcel != "function") {
        $scope.exportExcel = function(){
            if(gridConfig.page && gridConfig.page.bigTotalItems <= 0){
                Common.dialog({
                    type:'alert',
                    content:'查无数据，不允许导出!'
                });
                return;
            }
            var selectedColumns = []; 
            for(var i = 0;i<$scope.columns.length;i++){
                selectedColumns.push({
                isChecked:$scope.columns[i].isChecked,
                displayName:$scope.columns[i].displayName,
                name:$scope.columns[i].name
                });
            }
            var data = JSON.stringify({
                "clazz":"com.szboanda.platform.common.component.queryservice.analysis.service.impl.AnalysisServiceImpl",
                "xh" : gridConfig.xh,
                "exportFilds" : gridConfig.exportFilds,
                "downloadFileName" : gridConfig.title,
                "urlParams" : {"XH":"1591610606163024162304","isView":"","isImmediatelyQuery":true,"multi":true},
                "extendParam": gridConfig.dataConfig.data.extendParam,
                "executeQuery" : {
                    conditions : gridConfig.queryOptions.initQC
                },
                "selectedColumns":selectedColumns
                })
            Common.excelExport.doExport(data, $scope.token);
        };
    }
    //表格导出，支持json、txt、csv、xml、xls、doc、image、pdf类型，默认xls
    $scope.tableExport = function(fileType){
        if(!fileType){
            fileType ="xls";
        }
         tableExport('grid_tbody_table_'+gridConfig.xh, gridConfig.title,fileType);
    }
    //列表数据
    $scope.columns = [];
    $scope.showBackData = function(){
        Common.send($scope, $http, {
            method: 'POST',
            url: Common.webRoot() + '/common/component/queryservice/design/controller/dynamicquerycontroller/getformconfig',
            data: {'XH':gridConfig.xh},
            success: function (result) {
                //按钮信息
            var totalLbsj = JSON.parse(result.data.list[0].PZLB);
                if(totalLbsj&&totalLbsj.columns){
                    
                    for(var i=0;i<totalLbsj.columns.length;i++){
                        totalLbsj.columns[i].isChecked = true;
                    }
                    $scope.columns = totalLbsj.columns;
                }
            }   
        });
    }
    $scope.showBackData();
    //显示或隐藏列表列
    $scope.selectGridColumn = function(column,index,event){
        $scope.columns[index].isChecked = !column.isChecked ;
        $scope.gridDropCompColumn.isopen = true;
        $scope.showOrHideGridColumn($scope.columns[index]);
        event.stopPropagation();
    }
    //显示或隐藏列表列
    $scope.showOrHideGridColumn = function(column){
        var columnName = column.name;
        if(column.isChecked){//显示
            $(".col-"+columnName).show();
            $(".thead-"+columnName).show();
            $(".tdbody-"+columnName).show();
        }else{
            $(".col-"+columnName).hide();
            $(".thead-"+columnName).hide();
            $(".tdbody-"+columnName).hide();
        }
    }
    //页面变化回调
    gridConfig.callback.pageChangedCallback = function(column){
        if($scope.columns&&$scope.columns.length>0){
            for(var i = 0;i<$scope.columns.length;i++  ){
                $scope.showOrHideGridColumn($scope.columns[i]);
            }
        }
    }
}]);
$(document).ready(function() {
    var id = '1591610606163024162304';
    //  $('#grid_tbody_table_'+id).fixedHeaderTable({ footer: false,cloneHeadToFoot: false, altClass: 'odd', autoShow: true });
      var tableCont = document.querySelector('#grid_tbody_'+id)
      /**
       * scroll handle
       * @param {event} e -- scroll event
       */
      function scrollHandle (e){
        var scrollTop = this.scrollTop;
        this.querySelector('thead').style.transform = 'translateY(' + scrollTop + 'px)';
      }

      tableCont.addEventListener('scroll',scrollHandle)
});

</script>
 </body>
 <div ng-show="false" ng-controller="ButtonAuthorityController"></div>
<div ng-show="false" ng-controller="setUserSkinController"></div>
<div ng-show="false" ng-controller="WebSocketController"></div>

<script>
    $(function () {
        Common.contentShow.init(); //iframe内部具体内容的框架高度和宽度在浏览器窗口大小变化时自适应
    });

    var behavorApp = null;
    try {
        // 初始化平台系统
        behavorApp = angular.module(APP_NAME);
    } catch (error) {
        Common.log(error);
        behavorApp = Common.initApp(['ui.grid.edit', 'ngAnimate', 'angular.filter','ngCookies']);;
    }
    var sessionID = TOP_WINDOW.window.sessionID ? TOP_WINDOW.window.sessionID : '';
    behavorApp.controller('setUserSkinController', ['$scope', '$http','$cookieStore','$window', function ($scope, $http,$cookieStore,$window) {
        $scope.UserSkin = JSON.parse($window.localStorage['UserSkin'] || '{}');
        if($scope.UserSkin && $scope.UserSkin.skinName){
            $('#colorLink').attr('href',Common.webRoot()+'/resources/platform/common/css/color-'+$scope.UserSkin.skinName+'.css');
            $('#loginColor').attr('href',Common.webRoot()+'/resources/login/login-'+$scope.UserSkin.skinName+'.css');
        }
    }]);


    //按钮权限控制    
    behavorApp.controller('ButtonAuthorityController', ['$scope', '$http', function ($scope, $http) {
        setTimeout(function(){
            if ($("*[bt-auth-id]").length > 0) {
                Common.send($scope, $http, {
                    method: 'POST',
                    url: Common.webRoot() + '/platform/rms/usercontroller/findcurrentuserbutton',
                    success: function(result){
                        var buttons = result.data;
                        
                        var btnElements = $("*[bt-auth-id]");
                        for(var i=0;i<btnElements.length;i++){
                            btnElements[i].style.display="none";
                            if(buttons){
                                for(var j=0;j<buttons.length;j++){
                                    if(btnElements[i].getAttribute("bt-auth-id") == buttons[j].ANXH && sessionStorage.getItem('currentMenu') && JSON.parse(sessionStorage.getItem('currentMenu')).CDBH == buttons[j].CDXH){
                                        btnElements[i].style.display="inline";
                                        break;
                                    }
                                }
                            }
                        }
                                                        
                    }
                });
            }
        });
        
    }]);
    
    // WebSocket连接
    behavorApp.controller('WebSocketController', ['$scope', '$http', function ($scope, $http) {
        // 用户登录并且开启WebSocket配置项才连接websocket
        if ($scope.CurrUser.YHID && 'true' == 'true' && 'ws://127.0.0.1:8787/platform/ws') {
            platform.webSocket.connect($scope, $http, {
                url : 'ws://127.0.0.1:8787/platform/ws'
            });
        }
    }]);
    
    // 离开页面时
    window.onbeforeunload = function() {
        
        for (key in platform.onbeforeunload.listeners) {
            var listener = platform.onbeforeunload.listeners[key];
            try {
                if (listener.func) {
                    listener.func();
                }
            } finally {
                continue ;
            }
        }
    }
        
</script>
<script type="text/javascript" src="/fwszpt/resources/power/ui/vendor/js/powerui-directive.js?v=2020-9-5"></script>
</html>